package com.yinlixian.frame.admin.entity;

import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.hibernate.validator.constraints.NotEmpty;

import java.io.Serializable;


/**
 * <p>
 * 用户信息
 * </p>
 *
 * @author yudm
 * @since 2017-03-01
 */
@TableName("sys_user")
public class SysUser extends BaseEntity<SysUser> {

    private static final long serialVersionUID = 1L;

    /**
     * 用户ID
     */
	@TableId("user_id")
	private Integer userId;
    /**
     * 登录名
     */
	@NotEmpty(message = "登录名不能为空")
	@TableField("login_name")
	private String loginName;
    /**
     * 用户姓名
     */
	private String username;
    /**
     * 邮箱
     */
	private String email;
    /**
     * 手机号
     */
	private String phone;
    /**
     * 密码
     */
	private String password;
    /**
     * 头像
     */
	@TableField("user_icon")
	private String userIcon;
    /**
     * 状态
     */
	private Integer status;

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUserIcon() {
		return userIcon;
	}

	public void setUserIcon(String userIcon) {
		this.userIcon = userIcon;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@Override
	protected Serializable pkVal() {
		return this.userId;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;

		if (o == null || getClass() != o.getClass()) return false;

		SysUser sysUser = (SysUser) o;

		return new EqualsBuilder()
				.append(userId, sysUser.userId)
//				.append(loginName, sysUser.loginName)
				.isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder(17, 37)
				.append(userId)
//				.append(loginName)
				.toHashCode();
	}

	@Override
	public String toString() {
		return "SysUser{" +
				"userId=" + userId +
				", loginName='" + loginName + '\'' +
				", username='" + username + '\'' +
				", email='" + email + '\'' +
				", phone='" + phone + '\'' +
				", password='" + password + '\'' +
				", userIcon='" + userIcon + '\'' +
				", status=" + status +
				'}';
	}
}
